import ReactDOM from 'react-dom/client';
import { Provider } from 'react-redux';
import { I18nextProvider } from 'react-i18next';
import { PersistGate } from 'redux-persist/integration/react';
import store, { persistor } from 'src/store';
import i18n from 'src/locales';
import App from './App.tsx';
import 'src/styles/global.less';

const container = document.getElementById('root');

if (!container) {
  throw new Error('No root element found');
} else {
  ReactDOM.createRoot(container).render(
    <Provider store={store}>
      <PersistGate persistor={persistor}>
        <I18nextProvider i18n={i18n}>
          <App />
        </I18nextProvider>
      </PersistGate>
    </Provider>,
  );
}
